﻿"""Import batch Pydantic schemas."""

from __future__ import annotations

from uuid import UUID, uuid4

from pydantic import Field

from ..models.import_batch import ImportStatus
from ..schemas.base import ORMBase, TimestampModel


class ImportBatchBase(ORMBase):
    """Base ImportBatch schema."""

    filename: str = Field(..., min_length=1, max_length=255)
    channel_hint: str | None = Field(None, max_length=50)
    record_count: int = Field(default=0, ge=0)
    status: ImportStatus = ImportStatus.PROCESSING


class ImportBatchCreate(ImportBatchBase):
    """Schema for creating an import batch."""

    id: UUID = Field(default_factory=uuid4)
    imported_by: int


class ImportBatchUpdate(ORMBase):
    """Schema for updating an import batch."""

    record_count: int | None = Field(None, ge=0)
    status: ImportStatus | None = None


class ImportBatchOut(ImportBatchBase, TimestampModel):
    """Schema for import batch output."""

    id: UUID
    imported_by: int
